<template>
	<div class="addShortcut" v-if="addzhuo" :style="{bottom:bottom + 'rpx'}">
		<div class="all">
			<div class="content">
				<div class="imgkdxgs">
					<image src="@/static/index/logo.jpeg" mode=""></image>
				</div>
				<div class="center">
					<div class="top_title">添加至桌面</div>
					<div class="bottom_title">轻触并按住即可手动放置</div>
				</div>
				<div class="add">
					<button class="u-reset-button bbb" open-type="addShortcut"
						@addshortcut="eventHandler">添加</button>
				</div>
				<div class="del">
					<image src="@/static/index/indexdel.svg" mode="" @click="deladdzhuo"></image>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	export default {
		props:{
			bottom:{
				type:Number,
				default:12
			}
		},
		data(){
			return{
				addzhuo: uni.getStorageSync('addzhuo') || '',
			}
		},
		
		created(){
			let addzhuo = uni.getStorageSync("addzhuo")
			if (addzhuo === '') {
				this.addzhuo = true
				uni.setStorageSync('addzhuo', true)
			}
		},
		
		methods:{
			deladdzhuo() {
				this.addzhuo = false
			},
			
			eventHandler(e) {
				if (e.detail.errNo) {} else {
					this.addzhuo = false
					uni.setStorageSync('addzhuo', false)
				}
			},
		}
	}
</script>

<style lang="less" scoped>
	.addShortcut{
		width: 96%;
		height: 120rpx;
		position: fixed;
		bottom: 12rpx;
		left: 2%;
		border-radius: 20rpx;
		.all{
			width: 100%;
			height: 100%;
			position: relative;
			border-radius: 20rpx;
			background: rgba(0, 0, 0, .3);
			.image{
				position: absolute;
				width: 100%;
				height: 120rpx;
				left: 0;
				top: 0;
				z-index: -10;
				opacity: 0.8;
			}
			.content{
				width: 100%;
				height: 100%;
				z-index: 9999;
				color: #000;
				border-radius: 20rpx;
				display: flex;
				align-items: center;
				.imgkdxgs{
					margin-left: 52rpx;
					width: 70rpx;
					height: 70rpx;
					border-radius: 50%;
					overflow: hidden;
					image{
						width: 100%;
						height: 100%;
					}
				}
				.center{
					margin-left: 52rpx;
					.top_title{
						font-weight: 700;
						font-size: 36rpx;
						color: #FFFFFF;
					}
					.bottom_title{
						font-weight: 400;
						color: #26262C;
						font-size: 20rpx;
						margin-top: 10rpx;
					}
				}
				.add{
					width: 120rpx;
					height: 44rpx;
					border-radius: 200rpx;
					background-color: #fff;
					color: #000;
					text-align: center;
					line-height: 44rpx;
					font-size: 24rpx;
					font-weight: 500;
					margin-left: 88rpx;
					.u-reset-button{
						color: #333;
					}
				}
				.del{
					width: 21rpx;
					height: 21rpx;
					margin-bottom: 16rpx;
					margin-left: 50rpx;
					image{
						width: 100%;
						height: 100%;
					}
				}
			}
		}
	}
</style>